﻿<?php
class WriteActionController extends ActionController {

    public function run() {
        
        if($this->isPost()) {
            $articleMapper = new ArticleMapper();
            $art = new Article($this->getPost());
            $newArt = $articleMapper->writeArticle($art, $this->user->id);
            if ( isset($newArt->notice) ) {
                $this->view->newArt = $newArt;
            } else {
                $this->redirect('index');
            }
        } 
        $this->view->setRenderTemplate('write.phtml');
    }
}

?>